/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package managedBeans;

import ejb.ServicioArea;
import entities.Area;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author curso
 */
@ManagedBean
@RequestScoped
public class AreaBean {
  @EJB 
    private ServicioArea sa;
    private Area area;
    
    
    /** Creates a new instance of AreaBean */
    public AreaBean() {
    }
    @PostConstruct
    public void inicializar(){
        area=new Area();
    }

    public Area getArea() {
        return area;
    }

    public void setArea(Area area) {
        this.area = area;
    }
    public String guardar(){
        System.out.println("_____________Area:      "+area);
        sa.altaArea(area);
        area.setTipo("");
        return "altas.faces";
    }
    public List<Area> verAreas(){
        return sa.verAreas();
    }
}
